package com.hui.tset01.util;


/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录用户id
 */
public class BaseContext {

    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    //存储用户id
    public static void setUserId(Long userId) {
        threadLocal.set(userId);
    }
    //获取用户id
    public static Long getUserId() {
        return threadLocal.get();
    }
}
